Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print Preview #243

Open
wants to merge 22 commits into
base: version-14
Choose a base branch
from
Open

Print Preview #243

wants to merge 22 commits into from

Conversation

agritheory
Copy link
Owner

@agritheory agritheory commented May 14, 2024

To do:

  • Better styling of preview page
  • Fix example print format
  • Screenshot / Playwright test for primary, secondary and summary print view (move to separate issue)
  • Remove print/ get pdf HTML
  • Pull in settings / defaults from Check Run Settings
  • Provide sample (summary) Check Run print format
  • Provide no-print background image field of check stock with watermark
  • Integrate "Print" button into increment_print_count workflow
  • Update documentation for Print Settings section in Check Run Settings and more info around example print formats (including voucher number considerations around overflow for printing)
  • Patch for new Printable Modes of Payment in Check Run Settings

image

@agritheory agritheory marked this pull request as draft May 14, 2024 21:28
@viralkansodiya
Copy link
Contributor

viralkansodiya commented May 28, 2024

@agritheory

can you please explain what should I do in this task?

Screenshot / Selenium test for primary, secondary and summary print view

@agritheory
Copy link
Owner Author

@viralkansodiya For this task, I'll move it into its own ticket. It involves adding some dependencies.

@agritheory
Copy link
Owner Author

@viralkansodiya I am getting a Content Not Found Error that's coming from one or both of the print formats. Can you take a look at this?

@viralkansodiya
Copy link
Contributor

@agritheory I hope you are testing this print preview PR in version 14

@viralkansodiya
Copy link
Contributor

@viralkansodiya I am getting a Content Not Found Error that's coming from one or both of the print formats. Can you take a look at this?

@agritheory can you send me some more details? or if we can connect on call, so I can fix it quickly.

agritheory and others added 4 commits July 22, 2024 16:33
* remove print Get pdf

* fetch all payment entry preview in one single preview

* override a print button

* print page breake issue resolve

* print on specific url

* fix: Url of print

* PDF Button override

* on draft stage only allow check run default print format

* on draft stage only allow check run default print format

* if check run in draft then print should show msg

* remove unrelevent controll

* ci: track overrides por Payment Entry (#248)

* on change of doctype change list of print format

* change the preview and print view on change of selcted options

* render pdf base on selected print_sel

* create new print format 'Check Run'

* remove standard formats

* added a background image in check format

* set the size of check format background image

* back ground image only allow in print not in pdf

* Confirm print pop up

* Secondary print format added

* remove background image in pdf

* reformat by pre-commit

* Change syntex

* closed the window after action on print window

---------

Co-authored-by: Francisco Roldán <[email protected]>
@agritheory
Copy link
Owner Author

@viralkansodiya I was able to solve the content not found issue. Please update the "Example Voucher" print format so that it is sensitive to overflow (secondary print format feature), this is the comma separated list of source documents.

@viralkansodiya
Copy link
Contributor

Screenshot 2024-07-23 101018

@agritheory example voucher is already there in my pull request

@HKuz
Copy link
Collaborator

HKuz commented Jul 31, 2024

@agritheory this should be close. I wasn't sure what to add for the no-print background image. Latest commits include:

  • Example Voucher: removed the loop that was adding references 2x, checks Print Settings for page size, fixed some missing closing tags. Only prints payments associated with a new Mode of Payment Multiselect Table in Check Run Settings (DESIGN DECISION: I added the multiselect table in settings, but we do explicitly mention in the docs that a Mode of Payment with type "Bank" is special - it indicates the MOP requires physical printing. Another option is to cut out the multiselect table and just collect the MOPs of type Bank and compare against that).
  • Cleans up a few minor things in the Secondary format
  • adds a patch for the new multiselect table (QUESTION: for patches, do we need to call them anywhere or just having ithe execute function okay?)
  • fixed the minor issue with repeated Jan date in test data
  • updated track overrides hashes
  • updates docs

Potentially outstanding:

  • In print_check_run.js setup_sidebar, I pull the defaults for Number of Invoices per Voucher and Print Format, but for some reason the Print Format isn't setting as the default in the sidebar.

@agritheory agritheory marked this pull request as ready for review August 28, 2024 13:27
@agritheory
Copy link
Owner Author

Refactored the print format selection to a dynamic link
Pagination is still weird, might be the 'page-break' class in check_run.py might be something else.
How to we get labels for the form fields in the sidebar

@HKuz
Copy link
Collaborator

HKuz commented Sep 18, 2024

Latest push fixes a couple things, but here are a few observations in testing this:

  • the PDF render doesn't necessarily respect the print preview's dashed page break lines - I ran a Check Run for one person's payroll and paid 6 items, with the number_of_invoices_per_voucher set to 5, so one overflow. The preview separated them fine but the PDF wasn't adding the page break between the vouchers. Seems fixed by adding a line of code in the print preview for the page break
  • Part of the overflow problem stems from a change in v14 that ignores number_of_invoices_per_voucher if there's a Secondary Print Format set in Check Run Settings, as noted in this comment (see code here). When my settings for Payroll have that field set, Check Run lumps all the references into one Payment Entry, so printing preview shows the overflow (but oddly, actually rendering the PDF didn't seem to be a problem).
  • UPDATE (based on team call): document the secondary print format / invoices per voucher behavior and wrap a function in the preview - if Secondary Print Format exists in Settings, then don't render the invoices as table row, render them as comma-separated list to avoid overflow.

The latest change with the page break at the end of the print format seems to conform the preview and actual PDF page breaks, but I'm only testing when the Check Run Setting secondary print format field is blank.

@HKuz
Copy link
Collaborator

HKuz commented Sep 18, 2024

Latest push refactors the Example Voucher so if the Secondary Print Format is set in Check Run Settings, then the references are displayed as a comma-separated list. I tweaked the left positions of the date and paid amount, too - they were wrapping or cutting off in the actual PDF render.

Screen shots of the outcome now:

With Secondary Print Format set - multiple people renders okay too.

prev_w_secondary_print_format

Without Secondary Print Format set - fine for one person, more than 12 invoices is pushing the space limit. The preview still has display issues when there are multiple people being paid in the CR, but oddly the PDF render is fine
prev_no_secondary_print_format

@HKuz
Copy link
Collaborator

HKuz commented Oct 11, 2024

@agritheory - just reviewed this again - should be good to go. The new condition to render references as a list (if the Check Run Settings has a secondary print format set) gets rid of the overflow problem.

I made one small tweak in latest commits to cover the case where if the number of references in the Payment Entry is > 6 (regardless of the Secondary Print Format value in CR Settings), then it renders as a comma-separated list, too. I used 6 because that's what the preview page real estate seemed to max out at before there were the overflow issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants